﻿<UserControl x:Class="XmlExplorer.NamespacePrefixList"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:local="clr-namespace:XmlExplorer"
    mc:Ignorable="d" 
    d:DesignHeight="240" d:DesignWidth="640">
    
    <UserControl.Resources>

        <Style TargetType="Label">
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="HorizontalAlignment" Value="Right" />
            <Setter Property="Margin" Value="3" />
        </Style>

        <Style TargetType="TextBox">
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="Margin" Value="3" />
        </Style>
        
    </UserControl.Resources>
    
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        
        <TextBlock Grid.Row="0" Margin="3"
                   TextWrapping="Wrap">
            XML Explorer has detected the following namespaces.
            In order to be able to execute XPath statements against elements in these namespaces, XML Explorer needs a prefix for each namespace.
            Please note the prefix for each namespace.<LineBreak />
            <Bold>You will need to use these prefixes in any XPath statements.</Bold>
        </TextBlock>

        <my:DataGrid Grid.Row="1" Name="dataGrid" xmlns:my="http://schemas.microsoft.com/wpf/2008/toolkit"
                     ItemsSource="{Binding}" AutoGenerateColumns="False" Margin="3" IsReadOnly="True" HeadersVisibility="Column" GridLinesVisibility="None">
            <my:DataGrid.Columns>
                <my:DataGridTextColumn Header="Prefix" Binding="{Binding NewPrefix}" Width="Auto" />
                <my:DataGridTemplateColumn Header="Namespace" Width="*">
                    <my:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Namespace}" />
                        </DataTemplate>
                    </my:DataGridTemplateColumn.CellTemplate>
                </my:DataGridTemplateColumn>
            </my:DataGrid.Columns>
        </my:DataGrid>
    </Grid>
</UserControl>
